// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store/index'
import ElementUI from 'element-ui';
import './assets/css/main.css'
import 'element-ui/lib/theme-chalk/index.css';
import axios from "axios";
import VCharts from "v-charts";
import 'mavon-editor/dist/css/index.css'
import mavonEditor from 'mavon-editor'  // 引入mavon-editor 就是上面所安装的


Vue.use(mavonEditor)  // 让Vue使用mavonEditor
Vue.use(ElementUI);
Vue.use(VCharts);
Vue.config.productionTip = false
Vue.prototype.$axios = axios;

//异步请求后，判断token是否过期
axios.interceptors.response.use(
  response => {
    return response;
  },
  error => {
    if (error && error.response) {
      switch (error.response.status) {
        case 601: console.log('无权进行当前操作'); break;
        case 602: console.log('权限验证失败，请退出登陆后重试');break;
        default: console.log('出错，请联系管理员');
      }
    }else{
      error.message ='连接服务器失败!'
    }
    return error;
  }
)


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
